﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace QZone.crlclr.album.data
{
    public class Picture:XMLBinder
    {
        public string name;
        public string desc;

        public string thumbPath;
        public string urlPath;


        public string localThumbPath;
        public string localUrlPath;

        protected string qqcode;
        protected string key;
        public Picture(string qqcode,string key)
        {
            this.qqcode = qqcode;
            this.key = key;
        }

        public override void bindXML(XmlElement ele)
        {
            this.name = ele.SelectSingleNode("name").InnerText.Trim();
            this.desc = ele.SelectSingleNode("desc").InnerText.Trim();

            XmlNode node = ele.SelectSingleNode("pre");
            this.thumbPath =node.InnerText.Trim();
            this.localThumbPath = string.Format("{0}/{1}/thumb/{2}.jpg", qqcode, key, name);
            node.InnerText = this.localThumbPath;

            node=ele.SelectSingleNode("url");
            this.urlPath = node.InnerText.Trim();

            this.localUrlPath=string.Format("{0}/{1}/ipage/{2}.jpg", qqcode, key, name);
            node.InnerText = this.localUrlPath;
        }
    }
}
